package com.joeyzh.base;

import com.joey.ui.general.BaseActivity;

/**
 * Created by Joey on 2018/12/4.
 *
 * @author by Joey
 */

public abstract class BaseMvvmActivity<Entity, VM extends IViewModel<Entity>, PT extends IPresenter<VM>> extends BaseActivity implements MvvmCreateDelegate<Entity, VM, PT> {

    protected PT presenter;
    protected VM viewModel;
    protected Entity entity;


    @Override
    public void initData() {
        entity = getEntity();
        viewModel = createViewModel(entity);
        presenter = createPresenter(viewModel);
    }

    public PT getPresenter() {
        return presenter;
    }

    public VM getViewModel() {
        return viewModel;
    }
}
